package mail

import (
	"io"
	"os"
)

type ReaderWithoutCRLF struct {
	io.Reader
	last byte
}

func NewReaderWithoutCRLF( in io.Reader) (*ReaderWithoutCRLF) {
	return &ReaderWithoutCRLF{ in, 0}
}

func (r *ReaderWithoutCRLF) Read(p []byte) (n int, err os.Error) {
 	p[0] = '\n'
	for p[0] == '\n' || p[0] == '\r' {
	 	_, err = r.Reader.Read(p[0:1])
		if err != nil {
			//logger.Printf ("err:%v", err) 	
			return 0, err
		}
	}
//logger.Printf ("*leido:%c %02x", p[0], p[0]) 	
	return 1, nil
}
